/**
 * @file HandlerCall.cpp
 * @author Derek Liu (yjkhtddx@sina.com)
 * @brief 呼叫处理
 * @version 0.0.1
 * @date 2020-07-18
 * 
 * @coryright Copyright Sci-Tech Laboratories (c) 2020
 * 
 */

#include "HandlerCall.hpp"
#include "STL_Log.hpp"
#include "DBMgr.hpp"
#include "defs.hpp"
#include <eXosip2/eX_setup.h>
#include "Global.hpp"

int HandlerCall::HandleResponseSuccess(const sip_event_sptr &e)
{

    stl::debug("CALL RES status_code:%d",e->exevent->response->status_code);
    if(e->exevent->response->status_code != 200) return 0;

    osip_message_t *ack = NULL;
    eXosip_lock(e->excontext);
    eXosip_call_build_ack(e->excontext,e->exevent->tid,&ack);
    eXosip_call_send_ack(e->excontext,e->exevent->tid,ack);
    eXosip_unlock(e->excontext);

    stl::log("send CALL ACK");
    return 0;
}